<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>塞纳皇宫-网站后台管理系统</title>

    <meta name="keywords" content="">

    <meta name="description" content="">

    <link rel="icon" href="/static/admin/img/logo.png" type="image/x-icon">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">

    <link href="/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="/static/admin/css/animate.css" rel="stylesheet">

    <link href="/static/admin/css/style.css?v=4.1.0" rel="stylesheet">

    <link href="/static/admin/css/plugins/datapicker/datepicker3.css" rel="stylesheet">

    <link href="/static/admin/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">

    <script src="/static/admin/js/city/jquery-1.11.3.min.js"></script>



    <!-- 全局/static/admin//static/admin//static/admin/js -->

    <script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>

    <!-- 自定义js -->

    <script src="/static/admin/js/content.js?v=1.0.0"></script>

    <!-- jQuery Validation plugin javascript-->

    <!-- <script src="/static/admin/js/plugins/validate/jquery.validate.min.js"></script>-->

    <!--<script src="/static/admin/js/plugins/validate/messages_zh.min.js"></script>-->

    <!--<script src="/static/admin/js/demo/form-validate-demo.js"></script>-->

    <script src="/static/admin/js/plugins/datapicker/bootstrap-datepicker.js"></script>

    <script src="/static/admin/js/plugins/layer/laydate/laydate.js"></script>



    <!--script src="/static/admin/layer/layer.css"></script>-->

    <script src="/static/admin/layer/layer.js"></script>

    <style>

        .uploadbtn1 ,.uploadbtn2{position: absolute;padding: 5px 10px;background: #23b7e5;border-radius: 5px;color: #ffffff;z-index: 4}

        .uploadbtn1,.uploadbtn2:hover{background: #19a9d5;cursor: pointer;}

        .form-control{cursor: pointer;}

    </style>

</head>



<body class="gray-bg">

<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">

        <div class="col-sm-12">

            <div class="ibox float-e-margins">

                <div class="ibox-title">

                    <h5>公司资料</h5>

                </div>



            </div>

        </div>

    </div>



    <div class="ibox-content">

        <form class="form-horizontal m-t" id="company-form" action="" method="post" onsubmit="return subForm()"  enctype="multipart/form-data" >

            <input name="id" id="id" value="{if isset($data)}{$data.id}{/if}" type="hidden">

            <div class="form-group">

                <label class="col-sm-1 control-label">网站名称：</label>

                <div class="col-sm-3">

                    <input id="web_name" name="web_name"  class="form-control" type="text" required=""  value="{if isset($data)}{$data.web_name}{/if}" >

                    <!--  <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请输入公司名称</span>-->

                </div>

            </div>

            <div class="form-group">

                <label class="col-sm-1 control-label">网站地址：</label>

                <div class="col-sm-3">

                    <input id="web_site" name="web_site"  class="form-control" type="text" required=""  value="{if isset($data)}{$data.web_site}{/if}" >

                    <!--  <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请输入公司名称</span>-->

                </div>

            </div>





            <!--<div class="form-group">-->

                <!--<label class="col-sm-1 control-label">微信二维码：</label>-->

                <!--<div class="col-sm-2">-->

                    <!--<input id="wx_code"  class="form-control" type="file" name="wx_code" onchange="uploadImg(this,'imgupload1')" style="padding: 0;position: absolute; opacity: 0;z-index: 3 ;cursor: pointer;width:20px;">-->

                    <!--<p class="uploadbtn1" >点击上传图片</p>-->

                    <!--<input type="hidden" name="wx_code" value="{if isset($data)}{$data.wx_code}{/if}" >-->

                    <!--{if isset($data.wx_code) && $data.wx_code!==''}-->

                    <!--<img id ="imgupload1"  class='willshow' src="{if isset($data)}{$data.wx_code}{/if}" style=" display:block;max-height: 200px;margin-top: 32px"/>-->

                    <!--{else}-->

                    <!--<img id ="imgupload1"  class='willshow' src="" style=" display:none;max-height: 200px;margin-top: 32px"/>-->

                    <!--{/if}-->

                <!--</div>-->



            <!--</div>-->

            <!--<div class="form-group">-->



                <!--<label class="col-sm-1 control-label">微博二维码：</label>-->

                <!--<div class="col-sm-2">-->

                    <!--<input id="wb_code"  class="form-control" type="file" name="wb_code" onchange="uploadImg(this,'imgupload2')" style="padding: 0;position: absolute; opacity: 0;z-index: 3 ;cursor: pointer;width:20px;">-->

                    <!--<p class="uploadbtn2" >点击上传图片</p>-->

                    <!--<input type="hidden" name="wb_code" value="{if isset($data)}{$data.wb_code}{/if}" >-->

                    <!--{if isset($data.wb_code) && $data.wb_code!==''}-->

                    <!--<img id ="imgupload2"  class='willshow' src="{if isset($data)}{$data.wb_code}{/if}" style=" display:block;max-height: 200px;margin-top: 32px"/>-->

                    <!--{else}-->

                    <!--<img id ="imgupload2"  class='willshow' src="" style=" display:none;max-height: 200px;margin-top: 32px"/>-->

                    <!--{/if}-->

                <!--</div>-->



            <!--</div>-->

           <!-- <div class="form-group">

                <label class="col-sm-1 control-label">SEO标题：</label>

                <div class="col-sm-3">

                    <input id="seo_title" class="form-control" name="seo_title" value="{if isset($data)}{$data.seo_title}{/if}">

                </div>

            </div>

            <div class="form-group">

                <label class="col-sm-1 control-label">SEO关键词：</label>

                <div class="col-sm-3">

                    <input id="seo_keywords" class="form-control"  name="seo_keywords" value="{if isset($data)}{$data.seo_keywords}{/if}">

                </div>

            </div>

            <div class="form-group">

                <label class="col-sm-1 control-label">SEO描述：</label>

                <div class="col-sm-3">

                    <textarea style="height:100px;" id="seo_description"  class="form-control"  aria-required="true" name="seo_description">{if isset($data)}{$data.seo_description}{/if}</textarea>

                </div>

            </div> -->



            <div class="form-group">

                <label class="col-sm-1 control-label">公司地址(中文)：</label>

                <div class="col-sm-3">

                    <input id="address" class="form-control" required="" name="address" value="{if isset($data)}{$data.address}{/if}">

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">公司地址(英文)：</label>

                <div class="col-sm-3">

                    <input id="address_en" class="form-control" required="" name="address_en" value="{if isset($data)}{$data.address_en}{/if}">

                </div>

            </div>

            <div class="form-group">

                <label class="col-sm-1 control-label">新浪微博：</label>

                <div class="col-sm-3">

                    <input id="xlwb" class="form-control"  name="xlwb" value="{if isset($data)}{$data.xlwb}{/if}">

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">腾讯微博：</label>

                <div class="col-sm-3">

                    <input id="txwb" class="form-control"  name="txwb" value="{if isset($data)}{$data.txwb}{/if}">

                </div>

            </div>





            <div class="form-group">

                <label class="col-sm-1 control-label">微信：</label>

                <div class="col-sm-3">

                    <input id="wx"  class="form-control"  name="wx" value="{if isset($data)}{$data.wx}{/if}">

                </div>

            </div>

            <div class="form-group">

                <label class="col-sm-1 control-label">QQ：</label>

                <div class="col-sm-3">

                    <input id="qq" class="form-control" name="qq" value="{if isset($data)}{$data.qq}{/if}">

                </div>

            </div>

            <div class="form-group">

                <label class="col-sm-1 control-label">邮箱：</label>

                <div class="col-sm-3">

                    <input id="mail" class="form-control" name="mail" type="email" value="{if isset($data)}{$data.mail}{/if}">

                </div>

            </div>

            <div class="form-group">

                <label class="col-sm-1 control-label">服务热线：</label>

                <div class="col-sm-3">

                    <input id="sq_tel"  class="form-control"  name="tell"  value="{if isset($data)}{$data.tell}{/if}">

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">手机号码：</label>

                <div class="col-sm-3">

                    <input id="mobile"  class="form-control"  name="mobile"  value="{if isset($data)}{$data.mobile}{/if}">

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">备案号：</label>

                <div class="col-sm-3">

                    <input id="record" class="form-control"  name="record" value="{if isset($data)}{$data.record}{/if}">

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">客服链接：</label>

                <div class="col-sm-3">

                    <input id="service_link" class="form-control" name="service_link" value="{if isset($data)}{$data.service_link}{/if}" placeholder="例：http://www.baidu.com">

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">输入首页照片数量：</label>

                <div class="col-sm-3">

                    <input id="kh_num" class="form-control" name="kh_num" value="{if isset($data)}{$data.kh_num}{/if}" >

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">红包链接：</label>

                <div class="col-sm-3">

                    <input id="hb_link" class="form-control" name="hb_link" value="{if isset($data)}{$data.hb_link}{/if}" placeholder="例：http://www.baidu.com">

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">客服代码：</label>

                <div class="col-sm-4">

                    <textarea style="height: 100px;" id="service_code"  class="form-control"  aria-required="true" name="service_code">{if isset($data)}{$data.service_code}{/if}</textarea>



                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-1 control-label">统计代码：</label>

                <div class="col-sm-4">

                    <textarea style="height: 100px;" id="statis"  class="form-control"  aria-required="true" name="statis">{if isset($data)}{$data.statis}{/if}</textarea>

                </div>

            </div>

            <div class="form-group">

                <div class="col-sm-8 col-sm-offset-3">

                    <button class="btn btn-primary" type="submit" >提交</button>

                </div>

            </div>



        </form>

    </div>

</div>

</div>

</div>



</div>



<script src="/static/admin/js/city/area.js"></script>

<script src="/static/admin/js/city/select.js"></script>



<script  type="text/javascript">

    $(function(){

        $('.uploadbtn1').click(function(){

            return $('#wx_code').click();

        })

    })



    $(function(){

        $('.uploadbtn2').click(function(){

            return $('#wb_code').click();

        })

    })



    function subForm(){

        var formobj = document.getElementById('company-form')

        var formData = new FormData(formobj);

        var web_site = $("#web_site").val();

        var xlwb = $("#xlwb").val();

        var txwb = $("#txwb").val();

        var service_link = $("#service_link").val();

        var hb_link = $("#hb_link").val();

        if(web_site !==''){

            var reg=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;

            if(!reg.test(web_site)){

                layer.msg('请输入正确的网站地址');

                return false;

            }

        }

        if(xlwb !==''){

            var reg=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;

            if(!reg.test(xlwb)){

                layer.msg('请输入正确的新浪微博');

                return false;

            }

        }

        if(txwb !==''){

            var reg=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;

            if(!reg.test(txwb)){

                layer.msg('请输入正确的腾讯微博');

                return false;

            }

        }

        if(service_link !==''){

            var reg=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;

            if(!reg.test(service_link)){

                layer.msg('请输入正确的客服链接');

                return false;

            }

        }

        if(hb_link !==''){

            var reg=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;

            if(!reg.test(hb_link)){

                layer.msg('请输入正确的红包链接');

                return false;

            }

        }





        $.ajax({

            url:"/admin.php/System/editcompany",

            data:formData,

            type:"post",

            dataType:'json',

            processData: false,  // 告诉jQuery不要去处理发送的数据

            contentType: false,   // 告诉jQuery不要去设置Content-Type请求头

            success:function(res){

                if(1==res.code) {

                    layer.msg(res.msg);

                    setTimeout(function(){

                        window.location.reload();

                    },1000)

                }else{

                    layer.msg(res.msg);

                    return false;

                }

            },

            error:function(){

                layer.msg('系统错误');

                return false;

            },



        })

        return false;

    }

    function uploadImg(file, showImg) {

        if (!file.files[0]) {

            return false;

        }

        if (!file.value.match(/.jpg|.gif|.png|.jpeg/i)) {

            layer.msg('您选择的图片格式不正确，请重新选择');

            return false;

        }

        if (file.files[0].size > 1 * 1024 * 1024) {

            layer.msg('您选择的图片不能大于1M，请重新选择！');

            return false;

        }

        var myPhoto = document.getElementById(showImg);

        var reader = new FileReader();

        reader.onload = function (e) {

            var dataURL = e.target.result;

            myPhoto.src = dataURL;

            myPhoto.style.display = 'block';

        };

        reader.readAsDataURL(file.files[0]);

    }

</script>

</body>





</html>

